import request from '@/utils/request'
import store from '@/store'

export function getList(data) {
  return request({
    url: '/menu/commonList',
    method: 'post',
    data
  })
}

export function saveBatch(data) {
  return request({
    url: '/menu/saveBatch',
    method: 'post',
    data
  })
}

export const getAllRouters = () => {
  return request({
    url: '/menu/commonList',
    method: 'post',
    data: { 'page': { 'page': 1, 'pageSize': 9999
    }}
  })
}

export const getRouters = () => {
  const roles = store.getters.roles
  return request({
    url: '/customUser/getCustomMenu',
    method: 'get'
  })
}

export function getmenuByID(id) {
  return request({
    url: '/menu/selectById/' + id,
    method: 'get'
  })
}

export function deleteByID(id) {
  return request({
    url: '/menu/delete/' + id,
    method: 'get'
  })
}

export function updateBatch(data) {
  return request({
    url: '/menu/updateById',
    method: 'post',
    data
  })
}
